---
order: 1
title: Directional Light
type: Graphics
group: Lighting
label: Graphics/Light
---

**Directional Light** represents light that is emitted uniformly in a certain direction, with parallel light rays. Sunlight hitting the Earth's surface can be considered directional light because the distance between the Sun and the Earth is much greater than the Earth's radius. Therefore, sunlight hitting the Earth can be seen as a set of parallel light rays coming from the same direction, i.e., directional light.

<Image src="https://gw.alipayobjects.com/zos/OasisHub/a7f8b3f7-1a5f-4a56-8e57-1636a72aa1fb/image-20240319173643671.png" alt="image-20240319173643671" style={{ zoom: "50%" }} />


| Property     | Function                                                                 |
| :----------- | :----------------------------------------------------------------------- |
| Color        | Controls the color of the parallel light, default is white               |
| Culling Mask | Controls the objects that need to be illuminated by the light, default is Everything. Needs to be used in conjunction with the Entity's Layer |

> Directional light can cast shadows. For related configurations, refer to the [shadow documentation](/en/docs/graphics/light/shadow).

## Script Usage

```typescript
const lightEntity = rootEntity.createChild("light");
const directLight = lightEntity.addComponent(DirectLight);

// 调整颜色
directLight.color.set(0.3, 0.3, 1, 1);

// 调整方向
lightEntity.transform.setRotation(-45, -45, 0);
```
